
<template>
<div>
  <el-steps :active="listdata.step" align-center>
  <el-step title="步骤1" description="未报名"></el-step>
  <el-step title="步骤2" description="没有被打分"></el-step>
  <el-step title="步骤3" description="已被人打分"></el-step>
</el-steps>
</br>
</br>
  <el-table
    :data="datalist"
    style="width: 100%"
    max-height="250">
    <el-table-column
      fixed
      prop="id"
      label="编号"
      width="150">
    </el-table-column>
    <el-table-column
      prop="name"
      label="姓名"
      width="150">
    </el-table-column>
    <el-table-column
      prop="email"
      label="邮箱"
      width="230">
    </el-table-column>

    <el-table-column
      prop="result"
      label="加权平均分"
      width="320">
    </el-table-column>
        <el-table-column
      prop="total"
      label="总成绩"
      width="320">
    </el-table-column>
  </el-table>
  <el-button :loading="loading" round type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="getinfo">查询更新</el-button>
</div>

</template>

<script>
import indexApi from '@/api/examination/index.js'
  export default {

    data() {
      return {
        listdata:{         
          step:1,
        },
        datalist:[]
    }
  },

   created() { // 在渲染之前执行
        
    },
    mounted() { // 在渲染之后执行   

       
    },
    methods: {
      getinfo(){
        const email=document.cookie.split("vue_admin_template_token=")[1].split(";")[0];
        indexApi.getinfo(email).then(response => {
          console.log(response.data.step)
          if(response.data.step>=3){
              this.listdata.step=3
          }else{
            this.listdata.step=response.data.step
            if(response.data.step===2){
              this.$alert('你还没有被打分', '标题名称', {
                confirmButtonText: '确定',
              });
            }else{
              this.$alert('你还没有报名', '标题名称', {
                confirmButtonText: '确定',
              });
            }          
          }
          this.datalist=response.data.list
        })
      },
    }
  }
</script>